//
//  DCTransportingViewController.m
//  Driver
//
//  Created by 大橙子 on 2018/11/8.
//  Copyright © 2018 Tomous. All rights reserved.
//

#import "DCTransportingViewController.h"
#import "DCDCTransportingCell.h"
@interface DCTransportingViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) UITableView *tableView;
@property (nonatomic,strong) NSMutableArray *dataSource;

@end

@implementation DCTransportingViewController
-(UITableView *)tableView
{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.width, ScreenHeight - navHeight - statusHeight-50) style:UITableViewStylePlain];
        _tableView.separatorStyle = UITableViewCellStyleDefault;
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.backgroundColor = BackgroundColor;
    }
    return _tableView;
}
-(NSMutableArray *)dataSource
{
    if (!_dataSource) {
        _dataSource = [NSMutableArray new];
    }
    return _dataSource;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    NSArray *array = @[
                       @{
                           @"plateNum":@"京A11111",
                           @"name":@"张三",
                           @"state":@"运输中",
                           @"tel":@"17600907892",
                           @"location":@"北京市顺义区临河南大街9号院",
                           @"carNum":@"5",
                           @"suvNum":@"3",
                           },
                       @{
                           @"plateNum":@"京A22222",
                           @"name":@"李四",
                           @"state":@"运输中",
                           @"tel":@"17600907892",
                           @"location":@"北京市顺义区临河南大街9号院",
                           @"carNum":@"6",
                           @"suvNum":@"3",
                           },
                       @{
                           @"plateNum":@"京A33333",
                           @"name":@"张三",
                           @"state":@"运输中",
                           @"tel":@"17600907892",
                           @"location":@"北京市顺义区临河南大街9号院",
                           @"carNum":@"5",
                           @"suvNum":@"3",
                           },
                       @{
                           @"plateNum":@"京A44444",
                           @"name":@"张三",
                           @"state":@"运输中",
                           @"tel":@"17600907892",
                           @"location":@"北京市顺义区临河南大街9号院",
                           @"carNum":@"5",
                           @"suvNum":@"3",
                           },
                       ];
    [self.dataSource removeAllObjects];
    self.dataSource = [DCCarManagerModel mj_objectArrayWithKeyValuesArray:array];
    [self.view addSubview:self.tableView];
}
#pragma tableViewDelegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataSource.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    DCDCTransportingCell *cell = [DCDCTransportingCell cellWithTableView:tableView];
    cell.mModel = self.dataSource[indexPath.row];
    //    cell.delegate = self;
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return kBaseSubViewHeight*2+130;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    //    DCOrderDetailViewController *detailVC = [[DCOrderDetailViewController alloc]initWithOrderID:@""];
    //    [[UIViewController currentViewController].navigationController pushViewController:detailVC animated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
